Last updated: 2023-06-24

Checks: 7 0

Knit directory: scRNA_Qualitycheck/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20230211) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 3e4bd67. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  data/data/
    Untracked:  output/Cluster_markers.txt
    Untracked:  output/GO_termsCluster.xlsx
    Untracked:  output/Lineage1_comparison.xlsx
    Untracked:  output/Lineage2_comparison.xlsx
    Untracked:  output/Lineage3_comparison.xlsx
    Untracked:  output/Lineage4_comparison.xlsx
    Untracked:  output/Lineage5_comparison.xlsx
    Untracked:  output/Lineage6_comparison.xlsx
    Untracked:  output/PS_comparison.xlsx
    Untracked:  output/scRNA_seurat_integrated.Rdata
    Untracked:  output/shared.pseudo_comparison.xlsx

Unstaged changes:
    Modified:   _workflowr.yml
    Deleted:    output/README.md

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/05_GroupAnalysis_scRNA.Rmd) and HTML (docs/05_GroupAnalysis_scRNA.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 3e4bd67 achiocch 2023-06-24 workflowr::wflow_publish(c("./analysis/", "./docs/", "./code/*"))

recalc=T
if(recalc){
  load(file = "./output/scRNA_seurat_integrated.Rdata")}
if(!recalc){
  load(file = "./output/scRNA_seurat_integrated.Rdata")
}

Identifying markers LMER

Model genexpression ~ Diagnosis+(1|TR)+(1|BatchID)

  coldata = seurat_integrated@meta.data
  countdata = as.matrix(seurat_integrated@assays$SCT@scale.data)
  coldata$TR = gsub(".*(TR.)", "\\1", coldata$SampleID)
  
  model = as.formula("x ~ Diagnosis+(1|TR)+(1|BatchID)")
  
if(recalc){  
  runlmer = function(i, mod, gdata, cdata){
    #cat(i, end="\r")
    cdata$x=gdata[i,]
    res = suppressMessages(lmer(mod, data=cdata, verbose = 0))
    res = summary(res)
    return(res$coefficients[2,])
  }
  
  reslmer <- lapply(1:nrow(countdata), function(i){
    runlmer(i, gdata = countdata, mod = model, cdata = coldata)})
  names(reslmer) = rownames(countdata)
  reslmer <- do.call(rbind, reslmer)
  reslmer <- as.data.frame(reslmer)
  reslmer$p.value = 2*pt(abs(reslmer$`t value`), df=ncol(countdata)-1, lower=FALSE)
  reslmer$adj.p = p.adjust(reslmer$p, method="BH")
}
ggplot(reslmer, aes(x=Estimate, y=-log10(p.value), col=(adj.p<0.05)))+
  geom_point()
Plot markers LMER

Plot markers LMER

Identifying markers for Diagnosis

if(recalc){
  Idents(seurat_integrated) = "Diagnosis"
  
  Diagnosis.Markers= FindMarkers(seurat_integrated, 
                                assay = "integrated",
                                test.use = "wilcox",
                                ident.1 = "Ctrl", only.pos = F)
  
  Diagnosis.Markers <- Diagnosis.Markers[Diagnosis.Markers$p_val_adj<0.05,]
  Diagnosis.Markers %>%
    top_n(n = 20, wt = abs(avg_log2FC)) -> top10Diagnosis.Markers
  
  Diagnosis.Markers = Diagnosis.Markers[order(Diagnosis.Markers$avg_log2FC),]
}
DoHeatmap(seurat_integrated, features = rownames(top10Diagnosis.Markers), 
          group.by = "Diagnosis", assay = "integrated")
Heatmap grouped by Diagnosis

Heatmap grouped by Diagnosis

Calculating cell percentages

#Calculating the percentages of cell per cluster
number_perCluster<- as.data.frame.matrix(table(Samples=seurat_integrated$SampleID, 
                                               Clusters=scRNA.sce$seurat_clusters))
prop_per_Sample<- prop.table(table(Samples=scRNA.sce$Sample, 
                                   Clusters=scRNA.sce$seurat_clusters), margin = 1)

SampleData = unique(coldata[,c("SampleID", "BatchID", "Diagnosis", "TR")])


res = apply(prop_per_Sample, 2, function(x){summary(lmer(x~Diagnosis+(1|TR), data=SampleData))})
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
boundary (singular) fit: see help('isSingular')
ResFreq <- lapply(res, function(x) x$coefficients[2,]) %>% do.call(rbind,.) %>% as.data.frame()

ResFreq$pvalue = 2*pt(abs(ResFreq$`t value`), df=10, lower.tail = F)
ResFreq$p.adj = p.adjust(ResFreq$pvalue)

DT::datatable(ResFreq, extensions = "Buttons",
              filter="top",
              caption = paste0("Effects of Diagnosis on cluster"),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              ))

Genewise based cell cluster

Model

only within clusters genexpression ~ Diagnosis+(1|TR)+(1|BatchID)

if(recalc){
  reslist.by.cluster=list()
  for(i in unique(seurat_integrated$seurat_clusters)){
    #print(i)
    cellidx=coldata$seurat_clusters==i
    countdata.subset=countdata[,cellidx]
    reslmer.cluster <- lapply(1:nrow(countdata), function(i){
      runlmer(i, gdata = countdata.subset, mod = model, cdata = coldata[cellidx,])})
    reslmer.cluster <- do.call(rbind, reslmer.cluster)
    reslmer.cluster <- as.data.frame(reslmer.cluster)
    reslmer.cluster$p.value = 2*pt(abs(reslmer.cluster$`t value`), df=ncol(countdata)-1, lower=FALSE)
    reslmer.cluster$adj.p = p.adjust(reslmer.cluster$p, method="BH")
    row.names(reslmer.cluster) = rownames(countdata)
    reslist.by.cluster[[i]] = reslmer.cluster
    
  }

  
names(reslist.by.cluster) <- unique(seurat_integrated$seurat_clusters)

reslist.by.cluster = reslist.by.cluster[as.character(sort(unique(seurat_integrated$seurat_clusters)))]

DEX.reslist.by.cluster = lapply(reslist.by.cluster, function(x){rownames(x)[x$adj.p<=0.05 & 
                                                                              x$Estimate>=0.2]})

names(DEX.reslist.by.cluster)  <- names(reslist.by.cluster) 

gbackground = rownames(seurat_integrated)

Gost.reslist.by.cluster = lapply(DEX.reslist.by.cluster, function(x){gost(x, custom_bg = gbackground,
                                                                          evcodes = T)})

names(Gost.reslist.by.cluster)  <- names(reslist.by.cluster) 

}
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE
Detected custom background input, domain scope is set to 'custom'
No results to show
Please make sure that the organism is correct or set significant = FALSE

Results Cluster 0

x="0"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 1

x="1"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

Results Cluster 2

x="2"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 3

x="3"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 4

x="4"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 5

x="5"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

Results Cluster 6

x="6"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 7

x="7"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 8

x="8"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 9

x="9"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 10

x="10"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 11

x="11"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 12

x="12"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 13

x="13"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

## Results Cluster 14

x="14"
df = reslist.by.cluster[[x]]
df = df[order(df$adj.p, decreasing = F),]
DT::datatable(df, extensions = "Buttons",
              filter="top",
              caption = paste0("Genewise results cluster ",x),
              options = list(
                pageLength = 10,
                info = FALSE,
                lengthMenu = list(c(15,50, 100, -1),
                                  c("15","50", "100" ,"All")
                ),dom = 'Blfrtip',
                buttons = c('copy', 'csv', 'excel', 'pdf')
              )
)
ggplot(df, aes(x=Estimate, y=-log10(p.value), color=(adj.p<0.05)))+
      geom_point()+theme_classic()

if(is.null(Gost.reslist.by.cluster[[x]])){
  ggplot() +                      # Draw ggplot2 plot with text only
  annotate("text",
           x = 1,
           y = 1,
           size = 8,
           label = "no significant GO-terms associated") + 
  theme_void()
} else {
gostplot(Gost.reslist.by.cluster[[x]])}

save(reslist.by.cluster, DEX.reslist.by.cluster, top10Diagnosis.Markers, Gost.reslist.by.cluster, ResFreq, Diagnosis.Markers, reslmer, seurat_integrated, scRNA.sce, Cellpalette, SampleGPalette, SamplePalette, prop_per_Sample, file = "./output/scRNA_seurat_integrated.Rdata")

sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] lme4_1.1-31                 Matrix_1.5-3               
 [3] gprofiler2_0.2.1            viridis_0.6.2              
 [5] viridisLite_0.4.1           cowplot_1.1.1              
 [7] randomcoloR_1.1.0.1         RCurl_1.98-1.10            
 [9] RColorBrewer_1.1-3          data.table_1.14.6          
[11] lubridate_1.9.1             forcats_1.0.0              
[13] stringr_1.5.0               dplyr_1.1.0                
[15] purrr_1.0.1                 readr_2.1.3                
[17] tidyr_1.3.0                 tibble_3.1.8               
[19] tidyverse_1.3.2             scater_1.26.1              
[21] org.Hs.eg.db_3.16.0         AnnotationDbi_1.60.0       
[23] AnnotationHub_3.6.0         BiocFileCache_2.6.0        
[25] dbplyr_2.3.0                celldex_1.8.0              
[27] scuttle_1.8.4               ggplot2_3.4.0              
[29] slingshot_2.6.0             TrajectoryUtils_1.6.0      
[31] princurve_2.1.6             SeuratObject_4.1.3         
[33] Seurat_4.3.0                DropletUtils_1.18.1        
[35] SingleCellExperiment_1.20.0 SingleR_2.0.0              
[37] SummarizedExperiment_1.28.0 Biobase_2.58.0             
[39] GenomicRanges_1.50.2        GenomeInfoDb_1.34.9        
[41] IRanges_2.32.0              S4Vectors_0.36.1           
[43] BiocGenerics_0.44.0         MatrixGenerics_1.10.0      
[45] matrixStats_0.63.0          workflowr_1.7.0            

loaded via a namespace (and not attached):
  [1] rappdirs_0.3.3                scattermore_0.8              
  [3] R.methodsS3_1.8.2             bit64_4.0.5                  
  [5] knitr_1.42                    irlba_2.3.5.1                
  [7] DelayedArray_0.24.0           R.utils_2.12.2               
  [9] KEGGREST_1.38.0               generics_0.1.3               
 [11] ScaledMatrix_1.6.0            callr_3.7.3                  
 [13] RSQLite_2.2.20                RANN_2.6.1                   
 [15] future_1.31.0                 tzdb_0.3.0                   
 [17] bit_4.0.5                     xml2_1.3.3                   
 [19] spatstat.data_3.0-0           httpuv_1.6.8                 
 [21] assertthat_0.2.1              gargle_1.3.0                 
 [23] xfun_0.37                     hms_1.1.2                    
 [25] jquerylib_0.1.4               evaluate_0.20                
 [27] promises_1.2.0.1              fansi_1.0.4                  
 [29] readxl_1.4.1                  igraph_1.3.5                 
 [31] DBI_1.1.3                     htmlwidgets_1.6.1            
 [33] spatstat.geom_3.0-6           googledrive_2.0.0            
 [35] ellipsis_0.3.2                crosstalk_1.2.0              
 [37] backports_1.4.1               V8_4.2.2                     
 [39] deldir_1.0-6                  sparseMatrixStats_1.10.0     
 [41] vctrs_0.5.2                   ROCR_1.0-11                  
 [43] abind_1.4-5                   cachem_1.0.6                 
 [45] withr_2.5.0                   progressr_0.13.0             
 [47] sctransform_0.3.5             goftest_1.2-3                
 [49] cluster_2.1.4                 ExperimentHub_2.6.0          
 [51] lazyeval_0.2.2                crayon_1.5.2                 
 [53] spatstat.explore_3.0-6        labeling_0.4.2               
 [55] edgeR_3.40.2                  pkgconfig_2.0.3              
 [57] nlme_3.1-162                  vipor_0.4.5                  
 [59] rlang_1.0.6                   globals_0.16.2               
 [61] lifecycle_1.0.3               miniUI_0.1.1.1               
 [63] filelock_1.0.2                modelr_0.1.10                
 [65] rsvd_1.0.5                    cellranger_1.1.0             
 [67] rprojroot_2.0.3               polyclip_1.10-4              
 [69] lmtest_0.9-40                 boot_1.3-28.1                
 [71] Rhdf5lib_1.20.0               zoo_1.8-11                   
 [73] reprex_2.0.2                  beeswarm_0.4.0               
 [75] googlesheets4_1.0.1           whisker_0.4.1                
 [77] ggridges_0.5.4                processx_3.8.0               
 [79] png_0.1-8                     bitops_1.0-7                 
 [81] getPass_0.2-2                 R.oo_1.25.0                  
 [83] KernSmooth_2.23-20            rhdf5filters_1.10.0          
 [85] Biostrings_2.66.0             blob_1.2.3                   
 [87] DelayedMatrixStats_1.20.0     parallelly_1.34.0            
 [89] spatstat.random_3.1-3         beachmat_2.14.0              
 [91] scales_1.2.1                  memoise_2.0.1                
 [93] magrittr_2.0.3                plyr_1.8.8                   
 [95] ica_1.0-3                     zlibbioc_1.44.0              
 [97] compiler_4.2.2                dqrng_0.3.0                  
 [99] fitdistrplus_1.1-8            cli_3.6.0                    
[101] XVector_0.38.0                listenv_0.9.0                
[103] patchwork_1.1.2               pbapply_1.7-0                
[105] ps_1.7.2                      MASS_7.3-58.2                
[107] tidyselect_1.2.0              stringi_1.7.12               
[109] highr_0.10                    yaml_2.3.7                   
[111] BiocSingular_1.14.0           locfit_1.5-9.7               
[113] ggrepel_0.9.3                 grid_4.2.2                   
[115] sass_0.4.5                    timechange_0.2.0             
[117] tools_4.2.2                   future.apply_1.10.0          
[119] parallel_4.2.2                rstudioapi_0.14              
[121] git2r_0.31.0                  gridExtra_2.3                
[123] farver_2.1.1                  Rtsne_0.16                   
[125] digest_0.6.31                 BiocManager_1.30.19          
[127] shiny_1.7.4                   Rcpp_1.0.10                  
[129] broom_1.0.3                   BiocVersion_3.16.0           
[131] later_1.3.0                   RcppAnnoy_0.0.20             
[133] httr_1.4.4                    colorspace_2.1-0             
[135] rvest_1.0.3                   fs_1.6.1                     
[137] tensor_1.5                    reticulate_1.28              
[139] splines_4.2.2                 uwot_0.1.14                  
[141] spatstat.utils_3.0-1          sp_1.6-0                     
[143] plotly_4.10.1                 xtable_1.8-4                 
[145] nloptr_2.0.3                  jsonlite_1.8.4               
[147] R6_2.5.1                      pillar_1.8.1                 
[149] htmltools_0.5.4               mime_0.12                    
[151] DT_0.27                       minqa_1.2.5                  
[153] glue_1.6.2                    fastmap_1.1.0                
[155] BiocParallel_1.32.5           BiocNeighbors_1.16.0         
[157] interactiveDisplayBase_1.36.0 codetools_0.2-19             
[159] utf8_1.2.3                    lattice_0.20-45              
[161] bslib_0.4.2                   spatstat.sparse_3.0-0        
[163] curl_5.0.0                    ggbeeswarm_0.7.1             
[165] leiden_0.4.3                  survival_3.5-0               
[167] limma_3.54.1                  rmarkdown_2.20               
[169] munsell_0.5.0                 rhdf5_2.42.0                 
[171] GenomeInfoDbData_1.2.9        HDF5Array_1.26.0             
[173] haven_2.5.1                   reshape2_1.4.4               
[175] gtable_0.3.1